package com.sxtyxt.online.me;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.sxtyxt.online.ActBase;
import com.sxtyxt.online.R;

public class ActModifySex extends ActBase implements OnClickListener {
    private TextView txtMan, txtWoman, txtNoSex;
    private String sex = "1";

    @Override
    protected int getLayoutId() {
        return R.layout.modify_sex;
    }

    @Override
    protected void initUI() {
        super.initUI();
        txtMan = (TextView) findViewById(R.id.txt_man);
        txtWoman = (TextView) findViewById(R.id.txt_woman);
        txtNoSex = (TextView) findViewById(R.id.txt_no_sex);
        txtMan.setOnClickListener(this);
        txtWoman.setOnClickListener(this);
        txtNoSex.setOnClickListener(this);
        Button btnOk = (Button) findViewById(R.id.btn_ok);
        btnOk.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_ok:
                Intent intent = new Intent();
                intent.putExtra("sex", sex);
                setResult(RESULT_OK, intent);
                finish();
                break;
            case R.id.txt_man:
                sex = "1";
                txtMan.setCompoundDrawablesWithIntrinsicBounds(null, null,
                        getResources().getDrawable(R.drawable.ckbox_commen_checked), null);
                txtWoman.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
                break;
            case R.id.txt_woman:
                sex = "0";
                txtMan.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
                txtWoman.setCompoundDrawablesWithIntrinsicBounds(null, null,
                        getResources().getDrawable(R.drawable.ckbox_commen_checked), null);
                break;

            default:
                break;
        }
    }
}